<template>
  <div class="hello">
    <div @click="getHttp">get请求1</div>
    <div @click="getHttp2">get请求2</div>
    <div>{{dataStr}}</div>
  </div>
</template>

<script>
import axios  from "axios";
export default {
  name: 'HelloWorld',
  props: {
    msg: String,
  },
  data(){
    return{
      str:"",
      dataStr:{}
    }
  },
  methods:{
    getHttp(){
      console.log("getHttp");
      axios.get("http://localhost:8080/xyl1/get?generated-in=WebStorm")
      .then(res=>{
        console.log(res);
        this.dataStr = res.data
      },err=>{
        console.log('失败',err.message);
      })
    },
    getHttp2(){
      console.log("postHttp");
      axios.get("http://localhost:8080/xyl2/api/match/playerranking/match/NBA/tabld/60")
      .then(res=>{
        console.log(res);
        this.dataStr = res.data
      },err=>{
        console.log('失败',err.message);
      })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
